'use strict';

module.exports = {
  Query: {
    async user(root, { id }, ctx) {
      await ctx.helper.jwt();
      // console.log(ctx.state.user);
      return await ctx.connector.user.findById(id);
    }
  },
  Mutation: {
    async createUser(root, _, ctx) {
      await ctx.helper.jwt();
      const fields = _.fields;
      return await ctx.connector.user.create(fields);
    }
  }
}
